import 'package:cbec_app/utils/Tools.dart';
import 'package:cbec_app/utils/logger.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';

///店铺装修-富文本解析器
class DecorationRichTextParse extends StatefulWidget {
  ///富文本配置
  final Map<String, dynamic> info;

  const DecorationRichTextParse({super.key, required this.info});

  @override
  State<DecorationRichTextParse> createState() =>
      _DecorationRichTextParseState();
}

class _DecorationRichTextParseState extends State<DecorationRichTextParse> {
  @override
  Widget build(BuildContext context) {
    return Container(
        color: widget.info['color'] != ''
            ? Tools.fromHex(widget.info['color'])
            : Colors.transparent,
        child: HtmlWidget(
          widget.info['content'],
          customWidgetBuilder: (element) {
            // for (var item in element.styles) {
            //   logger.d('元素遍历 ${item.value}');
            // }
            return null;
          },
          ));
  }
}
